package com.sky.mapper;

import com.sky.entity.Setmeal;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
    @Insert("insert into setmeal(category_id, name, price, description, image) values (#{categoryId},#{name},#{price},#{description},#{image})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void add(Setmeal setmeal);

    @Select("select * from setmeal")
    List<Setmeal> getList();

    @Select("select * from setmeal where id=#{id}")
    Setmeal getById(Long id);

    @Select("select * from setmeal where category_id=#{categoryId}")
    List<Setmeal> getListBycategoryId(Long categoryId);
}
